package com.hb.sq3d.vos;

import android.graphics.PointF;

import java.util.List;

public class ModelArg {
    public int ID;
    public int type;
    public PointF pos;
    public float angle;// degree

    public int recog = -1;// for SSQK-project

    public ModelArg() {}

    public ModelArg(int ID, int type, PointF pos, float angle) {
        this.ID = ID;
        this.type = type;
        this.pos = pos;
        this.angle = angle;
    }

    public ModelArg(int ID, int type, PointF pos, float angle, int recog) {// for SSQK-project
        this.ID = ID;
        this.type = type;
        this.pos = pos;
        this.angle = angle;
        this.recog = recog;
    }

    public static class JNIData {
        public int[] ids;
        public int[] types;
        public float[] hDists;
        public float[] vDists;
        public float[] angles;
        public int[] recogs;// for SSQK-project
    }

    public static JNIData getJNIDataFromModels(List<ModelArg> modelArgs, boolean isSSQKProj) {
        int N = modelArgs.size();
        JNIData jniModelArgs = new JNIData();
        jniModelArgs.ids = new int[N];
        jniModelArgs.types = new int[N];
        jniModelArgs.vDists = new float[N];
        jniModelArgs.hDists = new float[N];
        jniModelArgs.angles = new float[N];
        if (isSSQKProj)
            jniModelArgs.recogs = new int[N];
        for (int i = 0; i < N; i++) {
            ModelArg model = modelArgs.get(i);
            jniModelArgs.ids[i] = model.ID;
            jniModelArgs.types[i] = model.type;
            jniModelArgs.hDists[i] = model.pos.x;
            jniModelArgs.vDists[i] = model.pos.y;
            jniModelArgs.angles[i] = model.angle;
            if (isSSQKProj)
                jniModelArgs.recogs[i] = model.recog;
        }
        return jniModelArgs;
    }
};